/**
 * (C) Copyright IBM Corp. 2022.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

import Foundation

/**
 Information about a document classifier model.
 */
public struct DocumentClassifierModel: Codable, Equatable {

    /**
     The status of the training run.
     */
    public enum Status: String {
        case training = "training"
        case available = "available"
        case failed = "failed"
    }

    /**
     A unique identifier of the document classifier model.
     */
    public var modelID: String?

    /**
     A human-readable name of the document classifier model.
     */
    public var name: String

    /**
     A description of the document classifier model.
     */
    public var description: String?

    /**
     The date that the document classifier model was created.
     */
    public var created: Date?

    /**
     The date that the document classifier model was last updated.
     */
    public var updated: Date?

    /**
     Name of the CSV file that contains the training data that is used to train the document classifier model.
     */
    public var trainingDataFile: String?

    /**
     Name of the CSV file that contains data that is used to test the document classifier model. If no test data is
     provided, a subset of the training data is used for testing purposes.
     */
    public var testDataFile: String?

    /**
     The status of the training run.
     */
    public var status: String?

    /**
     An object that contains information about a trained document classifier model.
     */
    public var evaluation: ClassifierModelEvaluation?

    /**
     A unique identifier of the enrichment that is generated by this document classifier model.
     */
    public var enrichmentID: String?

    /**
     The date that the document classifier model was deployed.
     */
    public var deployedAt: Date?

    // Map each property name to the key that shall be used for encoding/decoding.
    private enum CodingKeys: String, CodingKey {
        case modelID = "model_id"
        case name = "name"
        case description = "description"
        case created = "created"
        case updated = "updated"
        case trainingDataFile = "training_data_file"
        case testDataFile = "test_data_file"
        case status = "status"
        case evaluation = "evaluation"
        case enrichmentID = "enrichment_id"
        case deployedAt = "deployed_at"
    }

}
